﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;

namespace SmoLiteApi
{
    /// <summary/>
    public class IndexedColumnCollection : IEnumerable<IndexedColumn>
    {
        private List<IndexedColumn> _indexedColumns;

        /// <summary/>
        internal IndexedColumnCollection()
        {
            this._indexedColumns = new List<IndexedColumn>();
        }

        /// <summary/>
        public void Add(IndexedColumn indexedColumn)
        {
            this._indexedColumns.Add(indexedColumn);
        }

        /// <summary/>
        public IndexedColumn this[string name]
        {
            get { return this._indexedColumns.Find(value => value.Name == name); }
        }

        /// <summary/>
        public IEnumerator<IndexedColumn> GetEnumerator()
        {
            return this._indexedColumns.GetEnumerator();
        }

        /// <summary/>
        IEnumerator IEnumerable.GetEnumerator()
        {
            return this._indexedColumns.GetEnumerator();
        }

        /// <summary/>
        public int Count
        {
            get { return this._indexedColumns.Count; }
        }

        /// <summary/>
        public IndexedColumn this[int index]
        {
            get { return this._indexedColumns[index]; }
        }
    }
}
